package com.genice.util;

import java.util.HashMap;
import java.util.Map;

public class Result {
	private String msg;
	private int code;
	private Map<String,Object> datas;
	private Result(int code, String msg) {
		this.code = code;
		this.msg = msg;
		this.datas = new HashMap<String, Object>();
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public Map<String, Object> getDatas() {
		return datas;
	}
	public void setDatas(Map<String, Object> datas) {
		this.datas = datas;
	}
	public static Result FAILED(ErrorCode error){
		Result resp = new Result(0, error.getMsg());
		resp.code = error.getCode();
		return resp;
	}
	public static Result OK(String msg) {
		Result resp = new Result(1, msg);
		return resp;
	}
}
